<?php 
	/*$term_id=isset($_GET['term']) ? (int)$_GET['term'] : 0;
	if($term_id){		
		$content_list_data_provider = new CActiveDataProvider('Object',array(
                                'criteria'=>array(
                                        'condition'=>'object_id in (select object_id from `{{object_term}}` where term_id='.$term_id.')',
                                        'order'=>'object_date DESC',                                        
                                        'limit'=>10,                                
                                ),
                                'pagination'=>array(
                                        'pageSize'=>9, 
                                        'pageVar'=>'page'
                                ),
                               
                            )); 
	} else {
		 throw new CHttpException('404',t('Oops! Page not found!'));
	}*/
	
	$collection = null;
	$collection_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
	if($collection_id)
	{
		$collection = Object::model()->findByPk($collection_id);
		if(isset($collection)) {
			$criteria = new CDbCriteria();
			$criteria->join = 'JOIN gxc_object_term objterm on objterm.object_id=t.object_id';
			$criteria->condition = 'objterm.term_id in (select term.term_id from gxc_term term where term.name = :term_name)';
			$criteria->params = array(':term_name'=>$collection->object_name);
			$content_list_data_provider = new CActiveDataProvider('Object',array(
					'criteria'=>$criteria,
					'pagination'=>array(
							'pageSize'=>9,
							'pageVar'=>'page'
					),
			
			));
		}
		else {
			throw new CHttpException('404',t('Oops! Collection not found!'));
		}
		
	}
	else {
		throw new CHttpException('404',t('Oops! Collection not found!'));
	}
	
	
	
?>

		<?php 
				//So I get the first content list and want to return as a Data Provider
                //$content_list_data_provider = ListViewProductBlock::getContentList($this->content_list[0], null , null, ConstantDefine::CONTENT_LIST_RETURN_DATA_PROVIDER);		    
	            //Get the current content List model
                if (isset($content_list_data_provider) && $content_list_data_provider != null) : ?>
                <div class="span9" style="margin-left: 0px;">
                	<div class="hero-unit">
                		<h2>H.E.R Collection</h2>
                		<p>Some collection's intro....</p>
                	</div>
		  			<div class="row-fluid">
                	 	<?php 
                    	$this->widget('zii.widgets.CListView',
                                  array
                                  (
                                  	'viewData'=>array('asset'=>$this->layout_asset),
                                    'dataProvider'=>$content_list_data_provider,
                                    'itemView'=>'common.front_blocks.listview_product.item_render',
                                  	'itemsTagName'=>'ul',
                                  	'itemsCssClass'=>'thumbnails',
                                  	//'htmlOptions'=>array('style'=>'margin: 0px;'),
                                    'summaryText'=>'',
                                    'ajaxUpdate'=>true,
                                    'enablePagination'=> true,                                                                       
                                    'enableSorting'=>false,                           
                                    'sortableAttributes'=>array(),                                                       
                                    )
                                  );   
                            							                                                       
                		?>
                	</div>
                </div>
            	
            <?php endif; ?>